package com.xiaohe66.web.infrastructure.mybatis.birth.convert;

import com.xiaohe66.web.domain.birth.agg.Birthday;
import com.xiaohe66.web.infrastructure.domain.adapter.birth.BirthdayConverter;
import com.xiaohe66.web.infrastructure.mybatis.birth.model.BirthdayDo;
import com.xiaohe66.web.integration.DoConverter;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * @author xiaohe
 * @since 2023-07-12 15:41
 */
@Mapper(componentModel = "spring")
public interface BirthdayDoConverter extends DoConverter<Birthday, BirthdayDo>, BirthdayConverter {

    @Override
    Birthday toAgg(BirthdayDo doObj);

    @Mapping(target = "nextBirthday" , expression = "java(asNextBirthdayDate(agg))")
    @Override
    BirthdayDo toDo(Birthday agg);
}
